package com.itheima.controller;

import com.itheima.service.MethodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class Quick2Controller {
    @RequestMapping("/hello")
    @ResponseBody
    public String hello() {
        return "hello";
    }

    @RequestMapping("/admin/test")
    @ResponseBody
    public String testAdmin() {
        return "Hello Admin!";
    }

    @RequestMapping("/user/test")
    @ResponseBody
    public String testUser() {
        return "Hello User!";
    }

    @GetMapping("/login")
    @ResponseBody
    public String login() {
        return "please login";
    }

    @Autowired
    private MethodService methodService;

    @GetMapping("/hello1")
    @ResponseBody
    public String hello1() {
        return methodService.admin();
    }

    @GetMapping("/hello2")
    @ResponseBody
    public String hello2() {
        return methodService.user();
    }

    @GetMapping("/hello3")
    @ResponseBody
    public String hello3() {
        return methodService.hello();
    }

}
